home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15798 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  860 b 

  1. Path: newsbf02.news.aol.com!not-for-mail
  2. From: rodolfus@aol.com (Rodolfus)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: file descriptors and fstreams...
  5. Date: 6 Apr 1996 21:31:43 -0500
  6. Organization: America Online, Inc. (1-800-827-6364)
  7. Sender: root@newsbf02.news.aol.com
  8. Message-ID: <4k79ef$lq1@newsbf02.news.aol.com>
  9. References: <4k780i$dd5@beyond.escape.com>
  10. Reply-To: rodolfus@aol.com (Rodolfus)
  11. NNTP-Posting-Host: newsbf02.mail.aol.com
  12.  
  13. in c++ to get input from a file or send input to a file you can use
  14. functions ifstream 
  15. and ofstream from fstream.h in the following fashion:
  16.  
  17. ifstream in("nameofifle"); or
  18. ofstream out("nameoffile"); 
  19.  
  20. after this you can write for example
  21.  
  22. in >> ...
  23. out << ...
  24.  
  25. or you can even do this
  26. cin = in; or
  27. cout = out;
  28. and from that point on cin and cout will do I/O from the file named
  29. "nameoffile"
  30.  
  31.     I hope this helps you ...
  32.